package func;

import java.util.ArrayList;

public class ConditionalDoubleFuncs implements FunctionGroup<Double> {
	public ArrayList<Function<Double>> createFunctionGroup() {
		ArrayList<Function<Double>> f = new ArrayList<Function<Double>>();
		
		f.add(new Function<Double>() {
			public Double applyFunction(Double[] param) {
				if(param[0] != 0)
					return param[1];
				else
					return param[2];
			}
			public String description() {
				return "d_if";
			}
			public int paramCount() {
				return 3;
			}			
		});

		f.add(new Function<Double>() {
			public Double applyFunction(Double[] param) {
				if(param[0] > param[1])
					return 1.0;
				else
					return 0.0;
			}
			public String description() {
				return "d_grt";
			}
			public int paramCount() {
				return 2;
			}			
		});
		
		f.add(new Function<Double>() {
			public Double applyFunction(Double[] param) {
				if(param[0] == param[1])
					return 1.0;
				else
					return 0.0;
			}
			public String description() {
				return "d_eq";
			}
			public int paramCount() {
				return 2;
			}			
		});

		return f;
	}
	public String description() {
		return "conditionaldouble";
	}
}
